<?php
	$setDate = !empty($_POST['setDate']) ? $_POST['setDate'] : date('Y-m-d', time()); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의신</title>
    
    <link rel="stylesheet" type="text/css" href="/css/common.css">
    <link rel="stylesheet" type="text/css" href="/css/sub.css">
	<link rel="stylesheet" type="text/css" href="/css/free.css">
	
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script type="text/javascript">
		String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;};
		String.prototype.zf = function(len){return "0".string(len - this.length) + this;};
		Number.prototype.zf = function(len){return this.toString().zf(len);};
	
		var today = new Date();
		var yesterday = new Date( Date.parse( today ) - 1 * 1000 * 60 * 60 * 24 ); // 어제
		var tomorrow = new Date( Date.parse( today ) + 1 * 1000 * 60 * 60 * 24 ); // 내일

		var strToday     = today.getFullYear()+'-'+(today.getMonth()+1).zf(2)+'-'+today.getDate().zf(2);
		var strYesterday = yesterday.getFullYear()+'-'+(yesterday.getMonth()+1).zf(2)+'-'+yesterday.getDate().zf(2);
		var strTomorrow  = tomorrow.getFullYear()+'-'+(tomorrow.getMonth()+1).zf(2)+'-'+tomorrow.getDate().zf(2);

		function loadingAndSubmit() {
			$("#beginloading").css("visibility","visible");
			setTimeout(function() {
				$("#frm").submit();
			},1000);
		}

		$(document).ready(function() {
			
			$(".tab ul li").each(function(index) {
				$(this).removeClass('on').addClass('off');
			});
			
			$(function() {
				if ($("#setDate").val() == strYesterday) {
					$(".tab ul li").eq(0).addClass('on');
				} else if ($("#setDate").val() == strToday) {
					$(".tab ul li").eq(1).addClass('on');
				} else if ($("#setDate").val() == strTomorrow) {
					$(".tab ul li").eq(2).addClass('on');
				}
			});
			
			// 어제의 운세
			$("#yesterday").click(function() {
				$("#frm #setDate").val(strYesterday);
				loadingAndSubmit();
			});

			// 오늘의 운세
			$("#today").click(function() {
				$("#frm #setDate").val(strToday);
				loadingAndSubmit();
			});

			// 어제의 운세
			$("#tomorrow").click(function() {
				$("#frm #setDate").val(strTomorrow);
				loadingAndSubmit();
			});
		});
	</script>

</head>
<body>
<form id="frm" method="post" action="/unse/free/todaypreview/result">
	<input type="hidden" name="user_name" id="user_name" value="<?=$_POST['user_name']?>" />
	<input type="hidden" name="sex" id="sex" value="<?=$_POST['sex']?>" />
	<input type="hidden" name="birth_yyyy" id="birth_yyyy" value="<?=$_POST['birth_yyyy']?>">
	<input type="hidden" name="birth_mm" id="birth_mm" value="<?=$_POST['birth_mm']?>">
	<input type="hidden" name="birth_dd" id="birth_dd" value="<?=$_POST['birth_dd']?>">
	<input type="hidden" name="birth_hh" id="birth_hh" value="<?=$_POST['birth_hh']?>">
	<input type="hidden" name="birth_solunar" id="birth_solunar" value="<?=$_POST['birth_solunar']?>">
	<input type="hidden" name="target_yyyy" id="target_yyyy" value="<?=$_POST['target_yyyy']?>" />
	<input type="hidden" name="setDate" id="setDate" value="<?=$setDate?>" />
</form>

<div id="wrap">
	<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_header.php'; ?>
	<!--// Header -->
    
    <!--커튼 데코레이션-->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/drape.php'; ?>
	<!--//커튼 데코레이션-->
    
    <!--컨텐츠-->
	<div id="content">
		<!--나의 정보 /배너/실시간 운세차트-->
		<div class="keybox">
			<!--나의정보-->
			<?php echo $INC_MEMBER; ?>
			<!--//나의정보-->
			
			<!--키배너-->
			<div class="key_bn"><span><img src="/images/sub/free/key_v1.jpg" /></span></div>
			<!--//키배너-->
			
			<!--실시간 운세차트-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/unse_chart.php'; ?>
			<!--//실시간운세차트-->
		</div>
		<!--나의 정보 /배너/실시간 운세차트-->

		<!--왼쪽 컨텐츠-->
		<div class="assistant">
			<!--왼쪽 메뉴-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/inc_lnb.php'; ?>
			<!--// 왼쪽 메뉴-->
			
			<!--추천테마-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/theme.php'; ?>
			<!--//추천테마-->
            <!--후기게시판-->
            <div class="side">
                        <?php echo $INC_POSTSCRIPT_LIST ?>
             </div>

                <!--//후기게시판--> 
			
			<!--회원배너-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/member_join.php'; ?>
			<!--//회원배너-->
		</div>
		<!--//왼쪽 컨텐츠-->

		<!-- 메인컨텐츠-->
		<div class="cont">
		<!-- Contents -->
				<div class="today2">
				<h3 class="freetit"><img src="/images/free/today_banner.png" alt="오늘의 운세" /></h3>
                <div class="box">
				<div class="tab">
					<ul>
						<li class="off"><a href="javascript:;" id="yesterday">어제의 운세</a></li>
						<li class="off"><a href="javascript:;" id="today">오늘의 운세</a></li>
						<li class="off"><a href="javascript:;" id="tomorrow">내일의 운세</a></li>
					</ul>
				</div><!--datetab-->
				<div class="conts">
					
						<div class="todaydate">
							<p class="year">
								<img src="/images/common/day/day_<?=substr($setDate, 0,1)?>.png" alt="년도" />
								<img src="/images/common/day/day_<?=substr($setDate, 1,1)?>.png" alt="년도" />
								<img src="/images/common/day/day_<?=substr($setDate, 2,1)?>.png" alt="년도" />
								<img src="/images/common/day/day_<?=substr($setDate, 3,1)?>.png" alt="년도" />
								<img src="/images/common/day/day_dot.png" alt="점" />
							</p>
							<p>
								<img src="/images/common/day/day_<?=substr($setDate, 5,1)?>.png" alt="월" />
								<img src="/images/common/day/day_<?=substr($setDate, 6,1)?>.png" alt="월" />
								<img src="/images/common/day/day_dot.png" alt="점" />
							</p>
							<p>
								<img src="/images/common/day/day_<?=substr($setDate, 8,1)?>.png" alt="일" />
								<img src="/images/common/day/day_<?=substr($setDate, 9,1)?>.png" alt="일" />
							</p>
						</div><!--date-->
                        
                        <!--오늘의 일진점수-->
                        <div class="score">
                        	<p class="score_bg"><em><?=$contents['S087']['db_numerical']; ?></em></p>
                            <dl>
                            	<dt><img src="/images/free/sstit_today1.png" alt="오늘의 일진" /></dt>
                                <dd class="score_bx"><div class="blind" style="width:<?=$contents['S087']['db_numerical']; ?>%;">라인</div></dd>
                            </dl>
                        </div>
                        <!--//오늘의 일진점수-->
                        
						<div class="wordfortune">
							<h4 class="title"><img src="/images/free/sstit_today.png" alt="한마디운세" /><em class="word"><?=$contents['S087']['summary']; ?></em></h4>
                            <div class="box2">
                            	<p class="in"><?=$contents['S087']['db_data']; ?></p>
                            </div>
						</div><!--wordfortune-->

						<div class="nomb">
							<div class="bg">
								<p class="bt"><a href="/member/join"><img src="/images/free/bt_today_join.png" alt="회원가입하러가기" /></a></p>
							</div>
							
							<!--회원가입혜택배너-->
							<div class="sjoinbenefit">
								<p><img src="/images/member/ptit_freebenefit.png" alt="운세의 신 무료가입 파격 혜택" /></p>
								<p><a href="/member/join"><img src="/images/member/simg_freejoin.png" alt="운세의 신 무료가입 파격 혜택내용" /></a></p>
							</div>
							<!--//회원가입혜택배너-->
							<!--<p><a href="/product/package"><img src="/images/banner/vip_result_w730.jpg" alt="배너" /></a></p>-->
							
						</div>
					</div><!--conts-->
				</div><!--box-->
               
			</div><!--today--> 
            </div>
            
            
		<!--// Contents -->
    	<!--서비스배너-->
   
        <? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/bn_service.php'; ?>
        <!--//서비스배너--> 
       
        </div>
			
		<!--// 메인컨텐츠-->
        

<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_footer.php'; ?>
	<!--// Footer -->
</div>
</body>
</html>